package org.wx.io.netty.rpc.server;


import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;

import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import org.wx.io.netty.rpc.codec.RpcDecoder;
import org.wx.io.netty.rpc.codec.RpcEncoder;

/**
 * @description:
 * @author: wangxun
 * @createDate: 2021/2/23
 * @version: 1.0
 */
public class RpcServerInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ch.pipeline().addFirst("rpc encoder", new RpcEncoder())
                .addLast(new LoggingHandler(LogLevel.INFO))
                .addLast("rpc decoder",new RpcDecoder())
                .addLast("rpc client handler",new RpcServerHandler());
    }
}
